﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:Faust_Andrew_MTG_Player_Converters="clr-namespace:Faust.Andrew.MTG.Player.Converters"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" x:Name="UserControl"
	mc:Ignorable="d"
	x:Class="Faust.Andrew.MTG.Player.DockablePanel">
	<UserControl.Resources>
		<DataTemplate x:Key="ToggleTemplate">
			<Grid>
				<Image HorizontalAlignment="Stretch" Width="32" Height="Auto" Source="Download.png"/>
			</Grid>
		</DataTemplate>
	</UserControl.Resources>
	<UserControl.ContentTemplate>		
		<DataTemplate>
			<DataTemplate.Resources>
				<Faust_Andrew_MTG_Player_Converters:VisToBool x:Key="VisibleIfTrue" Inverted="True" Not="False" />
			</DataTemplate.Resources>
			<Grid x:Name="gridRoot" Background="{x:Null}">
				<Grid.RowDefinitions>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="*"/>
					<RowDefinition Height="Auto"/>
				</Grid.RowDefinitions>
				<Grid MinWidth="150" Background="#34F0F0F0">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="Auto"/>
						<ColumnDefinition Width="*"/>
						<ColumnDefinition Width="Auto"/>
					</Grid.ColumnDefinitions>
					<ToggleButton x:Name="toggleButton" Margin="0" Content="" d:LayoutOverrides="Width, Height" HorizontalAlignment="Left" VerticalAlignment="Center" ContentTemplate="{DynamicResource ToggleTemplate}" IsChecked="True" ToolTip="Expand/Contract"/>
					<Label Margin="5,0" Content="{Binding Title, ElementName=UserControl, Mode=OneWay}" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Background="{x:Null}" Foreground="White" FontSize="16"/>
					<Button x:Name="btnDetach" Grid.Row="0" HorizontalAlignment="Right" Margin="0" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="{x:Null}" Click="btnDetach_Click" Grid.Column="2" ToolTip="Detach">
						<Image Margin="0" Width="32" Source="Applications Cascade.png"/>
					</Button>
				</Grid>				
				<ContentPresenter x:Name="contentPresenter" Grid.Row="1" Content="{TemplateBinding Content}" Visibility="{Binding IsChecked, Converter={StaticResource VisibleIfTrue}, ElementName=toggleButton, Mode=OneWay}" ScrollViewer.CanContentScroll="True"/>
				<ResizeGrip HorizontalAlignment="Right" Grid.Row="2" VerticalAlignment="Bottom" Visibility="{Binding Visibility, ElementName=contentPresenter, Mode=Default}" PreviewMouseLeftButtonDown="Grip_PreviewMouseLeftButtonDown" PreviewMouseMove="Grip_PreviewMouseMove" PreviewMouseLeftButtonUp="Grip_PreviewMouseLeftButtonUp"/>
			</Grid>
		</DataTemplate>
	</UserControl.ContentTemplate>

	
</UserControl>